//
//  JCEventDetailVC.m
//  SquashSpark
//
//  Created by 郭吉成 on 2017/11/21.
//  Copyright © 2017年 Coollang-YF. All rights reserved.
//

#import "JCEventDetailVC.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import "JCClubEventModel.h"
#import "SQActionSheetView.h"

@interface JCEventDetailVC ()
@property (weak, nonatomic) IBOutlet UIImageView *thumbImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *placeLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;

@end

@implementation JCEventDetailVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initCode];
    [self loadData];
}

- (void)initCode{
    self.navigationItem.title = @"Details";
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"club_menu_list"] style:UIBarButtonItemStyleDone target:self action:@selector(menuAction:)];
}

- (void)menuAction:(UIBarButtonItem *)sender{
    __weak typeof(self)weakSelf = self;
    SQActionSheetView *sheetView = [[SQActionSheetView alloc] initWithTitle:nil buttons:@[@"Report",@"Cancel"] colors:@[[UIColor blackColor],[UIColor blackColor]] buttonClick:^(SQActionSheetView *sheetView, NSInteger buttonIndex) {
        if (buttonIndex == 0) {
            [weakSelf reportAction:_eventModel.eventID spotterIDType:SpotterIDTypeEvent];
        }
    }];
    [sheetView showView];
}

- (void)loadData{
    if (_eventModel) {
        [_thumbImageView sd_setImageWithURL:_eventModel.bannerList.firstObject placeholderImage:kPlaceholdImage];
        _nameLabel.text = _eventModel.title;
        _timeLabel.text = _eventModel.startTime;
        _placeLabel.text = _eventModel.place;
        _contentLabel.text = _eventModel.content;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
